<?php
/**
 * Created by 荣耀电竞.
 * User: 林子彦 <278805354@qq.com>
 * Date: 2018/8/10 0010
 * Time: 10:12
 */
namespace App\User\Controller;

use App\Base\Helpers\ApiResponse;
use App\User\Model\UsersModel;

class UserController{
    use ApiResponse;
    public function loginAction(){
//        echo "kkkkkk==>";
//        $user = new UsersModel();
////        echo $user->name;
////        echo "<==";
////        echo $user->getSource();
////        echo "<==";
////        echo basename(get_class($user));
//
//        //$user->save();
//        $user->save(["name"=>"测试","email"=>"278805354@qq.com"],[ "name", "email"]);
//        $response = new \Phalcon\Http\Response();
//
//// Set status code
//        $response->setStatusCode(404, "Not Found");
//
//// Set the content of the response
//        $response->setContent("Sorry, the page doesn't exist");
//
//// Send response to the client
//        $response->send();

       // $response->setContentType('application/json', 'UTF-8');
//      return   $this->response->setJsonContent([
//            'code' => 200,
//            'message' => "测试11",
//            'data' => ["aa"=>"bbb","cc"=>"ddd"]
//        ]);
        //$response->send();

        $response = new \Phalcon\Http\Response();
        $response->setHeader("Content-Type", "application/json");
        $response->setContentType('application/json', 'UTF-8');
        $response->setStatusCode(200, "OK");
       // $response->setContent("<html><body>Hello</body></html>");
        $response->setJsonContent([
            'code' => 200,
            'message' => "测试11",
            'data' => ["aa"=>"bbb","cc"=>"ddd"]
        ]);
        $response->send();
    }
}